﻿using UnityEngine;

public class ItemInfo:ItemData
{
    public int count;
    public bool isUnlock;
}

public class Item : BaseEffect<ItemData>
{
    private ItemInfo itemInfo=new ItemInfo();
    public ItemInfo ItemInfo { get => itemInfo; set => itemInfo=value; }
    public Item(ItemData data) : base(data)
    {
        this.Data = data;

        if (data is ItemInfo info)
        {
            itemInfo = info;
            Debug.Log("itemInfo 初始化");

        }
        else
        {
            Debug.Log("itemInfo 赋值属性");
            itemInfo = new ItemInfo
            {
                Id = data.Id,
                Name = data.Name,
                Type = data.Type,
                Descript = data.Descript,
                IconPath = data.IconPath,
                Kinds = data.Kinds,
                count = 0, // 默认值或设定的值
                isUnlock = false // 默认值或设定的值
            };
        }
    }
    public override string Name => GetType().Name;
    public override ItemData Data { get ; set ; }


    /// <summary>
    /// 具体实现效果
    /// </summary>
    public virtual void Apply()
    {
        UnityEngine.Debug.Log("使用效果"+Data.Name);
    }
}

